package com.haierp.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotations.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.haierp.model.purchase.PurchaseStorageDetail;

/**
 * 仓库库存
 * 
 * @author liuhui
 * 
 *         skuId + warehouseId + positionNo = 唯一约束
 */
public class InventoryArea implements Serializable {

	//private static final long serialVersionUID = -1178234464611799085L;
	/**
	 * 主键id
	 */
	@TableId(type = IdType.AUTO)
	private Long id;
	/**
	 * 商品id
	 */
	@TableField(value = "item_id")
	private Long itemId;
	/**
	 * skuid
	 */
	@TableField(value = "sku_id")
	private Long skuId;
	/**
	 * 商品名称
	 */
	@TableField(value = "item_name")
	private String itemName;
	/**
	 * sku码
	 */
	@TableField(value = "sku_code")
	private String skuCode;
	/**
	 * 图片
	 */
	@TableField(value = "sku_pic")
	private String skuPic;
	/**
	 * 商品条码
	 */
	@TableField(value = "upc")
	private String upc;
	
	/**
	 * 商品颜色
	 */
	private String color;
	
	/**
	 * 商品尺寸
	 */
	private String scale;
	/**
	 * 锁定库存
	 */
	@TableField(value = "locked_inv")
	private Integer lockedInv;
	
	/**
	 * 锁定在途库存量
	 */
	@TableField(value = "locked_trans_inv")
	private Integer lockedTransInv;
	/**
	 * 实际库存
	 */
	@TableField(value = "inventory")
	private Integer inventory;
	/**
	 * 在途库存
	 */
	@TableField(value = "trans_inv")
	private Integer transInv;
	/**
	 * 仓库Id
	 */
	@TableField(value = "warehouse_id")
	private Long warehouseId;
	/**
	 * 仓库名称
	 */
	@TableField(value = "warehouse_name")
	private String warehouseName;
	/**
	 * 货架编号
	 */
	@TableField(value = "position_no")
	private String positionNo;
	/**
	 * 创建时间
	 */
	@TableField(value = "gmt_create")
	private Date gmtCreate;
	/**
	 * 修改时间
	 */
	@TableField(value = "gmt_modify")
	private Date gmtModify;
	
	@TableField(exist = false)
	private String brand;
	@TableField(exist = false)
	private Double salePrice;
	/**
	 * 加入采购站点维度
	 */
	@TableField(exist = false)
	private String buySite;
	
	@TableField(value = "company_id") //所属公司
	private Long companyId;
	
	/***
	 * 库存管理图片
	 */
	@TableField(exist = false)
	private String invSkuPic;
	
	
	/**
	 * 采购明细数据
	 */
	@TableField(exist = false)
	private List<PurchaseStorageDetail> purchaseStorageDetailList;
	
    /**
     * 网购说明
     */
	@TableField(exist = false)
	private String tranDetailmark;
	
	public void setAvailableInv(Integer availableInv) {
		AvailableInv = availableInv;
	}

	@TableField(exist = false)
	private Integer AvailableInv;
	
	
	@TableField(exist = false)
	private Integer totalAvailableInv;

	@TableField(exist = false)
	private String onlineNumber;
	
	
	
	
	public void setTotalAvailableInv(Integer totalAvailableInv) {
		this.totalAvailableInv = totalAvailableInv;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getItemId() {
		return itemId;
	}

	public void setItemId(Long itemId) {
		this.itemId = itemId;
	}

	public Long getSkuId() {
		return skuId;
	}

	public void setSkuId(Long skuId) {
		this.skuId = skuId;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public String getSkuCode() {
		return skuCode;
	}

	public void setSkuCode(String skuCode) {
		this.skuCode = skuCode;
	}

	public String getSkuPic() {
		return skuPic;
	}

	public void setSkuPic(String skuPic) {
		this.skuPic = skuPic;
	}

	public String getUpc() {
		return upc;
	}

	public void setUpc(String upc) {
		this.upc = upc;
	}

	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public Double getSalePrice() {
		return salePrice;
	}

	public void setSalePrice(Double salePrice) {
		this.salePrice = salePrice;
	}

	public Integer getLockedInv() {
		if(lockedInv == null){
			lockedInv = 0;
		}
		return lockedInv;
	}

	public void setLockedInv(Integer lockedInv) {
		this.lockedInv = lockedInv;
	}

	public Integer getInventory() {
		if(inventory == null){
			inventory = 0;
		}
		return inventory;
	}

	public void setInventory(Integer inventory) {
		this.inventory = inventory;
	}

	public Integer getTransInv() {
		if(transInv == null){
			transInv = 0;
		}
		return transInv;
	}

	public void setTransInv(Integer transInv) {
		this.transInv = transInv;
	}

	public Long getWarehouseId() {
		return warehouseId;
	}

	public void setWarehouseId(Long warehouseId) {
		this.warehouseId = warehouseId;
	}

	public String getWarehouseName() {
		return warehouseName;
	}

	public void setWarehouseName(String warehouseName) {
		this.warehouseName = warehouseName;
	}

	public String getPositionNo() {
		return positionNo;
	}

	public void setPositionNo(String positionNo) {
		this.positionNo = positionNo;
	}

	public Date getGmtCreate() {
		return gmtCreate;
	}

	public void setGmtCreate(Date gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	public Date getGmtModify() {
		return gmtModify;
	}

	public void setGmtModify(Date gmtModify) {
		this.gmtModify = gmtModify;
	}
	
	public int getAvailableInv(){
		return this.getInventory() - this.getLockedInv();
	}
	
	public int getAvailableTransInv(){
		return this.getTransInv() - this.getLockedTransInv();
	}

	public Integer getLockedTransInv() {
		if(lockedTransInv == null){
			lockedTransInv = 0;
		}
		return lockedTransInv;
	}

	public void setLockedTransInv(Integer lockedTransInv) {
		this.lockedTransInv = lockedTransInv;
	}
	
	/**
	 * (总共)可用库存
	 * @return
	 */
	public Integer getTotalAvailableInv() {
		return getAvailableInv()+getAvailableTransInv();
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getScale() {
		return scale;
	}

	public void setScale(String scale) {
		this.scale = scale;
	}

	public String getBuySite() {
		return buySite;
	}

	public void setBuySite(String buySite) {
		this.buySite = buySite;
	}

	public Long getCompanyId() {
		return companyId;
	}

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	public String getInvSkuPic() {
		return invSkuPic;
	}

	public void setInvSkuPic(String invSkuPic) {
		this.invSkuPic = invSkuPic;
	}

	public List<PurchaseStorageDetail> getPurchaseStorageDetailList() {
		return purchaseStorageDetailList;
	}

	public void setPurchaseStorageDetailList(List<PurchaseStorageDetail> purchaseStorageDetailList) {
		this.purchaseStorageDetailList = purchaseStorageDetailList;
	}

	public String getTranDetailmark() {
		return tranDetailmark;
	}

	public void setTranDetailmark(String tranDetailmark) {
		this.tranDetailmark = tranDetailmark;
	}

	public String getOnlineNumber() {
		return onlineNumber;
	}

	public void setOnlineNumber(String onlineNumber) {
		this.onlineNumber = onlineNumber;
	}
}
